package com.wn32.main.demo6;

import java.util.concurrent.*;

public class Main7 {
    public static void main(String[] args) {
        Runnable r=()->{
            for (int i = 0; i <10 ; i++) {
                System.out.println(Thread.currentThread().getName()+":"+i);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(3, 6, 60000, TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>(10));
        threadPoolExecutor.execute(r);
        threadPoolExecutor.execute(r);
        threadPoolExecutor.execute(r);
        threadPoolExecutor.execute(r);

        System.out.println(Thread.currentThread().getName()+":蜗牛学院");
    }
}
